#ifndef SORT_H
#define SORT_H

#include "Algorithm.h"
#include <iostream>

using namespace JorenAlgorithm;
using namespace std;

namespace JorenAlgorithm
{
	class Sort : Algorithm
	{
	public:
		enum SORTMETHOD{INSERTSORT,QUICKSORT,MERGING};
	private:
		SORTMETHOD method;
		int* source;
		int len;
	public:
		int run();
		Sort(SORTMETHOD method, int * source, int len);
		void print();
		SORTMETHOD getMethod();
		void setMethod(SORTMETHOD method);
		int * getSource();
		void setSource(int* source);
		int getLen();
		void setLen(int len);
		~Sort();
	private:
		int sort();
		int insertSort();
		void mergeSort(int s, int t);
		void swap(int a, int b);
		void merge(int s, int m, int t);
	};
}

#endif